class HashedPassword;
class IVisitor {
public:
    ~IVisitor(){}
    virtual int consume(const HashedPassword & hash) const = 0;
};
class HashedPassword {
public:
    int foreach(IVisitor & visitor){
        for(auto & hashedPassword : this->hashedPasswords){
            if(false == visitor.consume(hashedPassword)){
                  return -1;
            }
        }
        return 0;
    }
};



class Visitor : public IVisitor{
public:
    int consume(const HashedPassword & hash) const override{
        std::cout << hash.toString() << std::endl;
        return 0;
    }
};
TEST(HashedPasswordTest_Original, testCustomVisitor){
    HashedPassword passwords;
    Visitor visit;
    ASSERT_EQ(0, passwords.foreach(visit));
}

//----- to do -->
class HashedPasswordTest : public testing::Test, IVisitor {
public:
    int consume(const HashedPassword & hash) const override{
        std::cout << hash.toString() << std::endl;
        return 0;
    }
};
TEST_F(HashedPasswordTest, testCustomVisitor){
    HashedPassword passwords;
    ASSERT_EQ(0, passwords.foreach(*self));
}
